
package beans;

/**
 *
 * @author Maryna
 * @param id - id of hdd stored in DB
 * @param name - name of hdd stored in DB
 * @param price - price of hdd stored in DB
 * @param manName - manufacturer name of hdd stored in DB
 * @param count - count of hdd stored in DB
 */
public class HDDBean {

    // describe an hdd
    
    
    private int id;
    private String name;
    private int price;
    private String manName;
    private int count;
    
       
    /** Creates a new instance of HDDBean */
    public HDDBean() {
        
    }
    
    public int getId() {
        return id;
    }
    
    public void setId(int _id) {
        id = _id;
    }

    public String getName() {
        return name;
    }
    
    void setName(String _name) {
        name = _name;
    }
    
    public int getPrice() {
        return price;
    }
    
    public void setPrice(int _price) {
        price = _price;
    }
    
    public String getManufacturerName() {
        return manName;
    }
    
    void setManufacturerName(String _manName) {
        manName =_manName;
    }

    public int getCount() {
        return count;
    }
    
    void setCount(int _count) {
        count =_count;
    }

    /** create an XML document describing the computer
     * 
     * @return XML document
     */
    
    public String getXml() {

	// use a Stringbuffer (not String) to avoid multiple
	// object creation

     StringBuffer xmlOut = new StringBuffer();
      
      xmlOut.append("<hdd>");
      xmlOut.append("<id>");
      xmlOut.append(id);
      xmlOut.append("</id>");      
      xmlOut.append("<name>");
      xmlOut.append(name);
      xmlOut.append("</name>");
      xmlOut.append("<price>");
      xmlOut.append(price);      
      xmlOut.append("</price>");
      xmlOut.append("<manName>");
      xmlOut.append(manName);
      xmlOut.append("</manName>");   
      xmlOut.append("<count>");
      xmlOut.append(count);
      xmlOut.append("</count>");
      xmlOut.append("</hdd>");
      
      return xmlOut.toString();
    
        
    }

    
}
